package com.woniu.springbootmybatis.service.impl;

import com.woniu.springbootmybatis.dao.CustomerDao;
import com.woniu.springbootmybatis.pojo.Customer;
import com.woniu.springbootmybatis.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CustomerServiceImpl implements ICustomerService {
    @Autowired
    private CustomerDao customerDao;
    @Override
    public List<Customer> findAll() {
        return customerDao.findAll();
    }

    @Override
    public boolean save(Customer customer) {
        boolean flag = false;
        try {
            customerDao.save(customer);
            flag = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }

    @Override
    public Customer findOne(Integer id) {
        return customerDao.findOne(id);
    }
}
